/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_permisconduire")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvPermisconduire.findAll", query = "SELECT c FROM CvPermisconduire c"),
    @NamedQuery(name = "CvPermisconduire.findByCvTravailleurId", query = "SELECT c FROM CvPermisconduire c WHERE c.cvTravailleurId = :cvTravailleurId"),
    @NamedQuery(name = "CvPermisconduire.findByNumeropermis", query = "SELECT c FROM CvPermisconduire c WHERE c.numeropermis = :numeropermis"),
    @NamedQuery(name = "CvPermisconduire.findByScanpermis", query = "SELECT c FROM CvPermisconduire c WHERE c.scanpermis = :scanpermis"),
    @NamedQuery(name = "CvPermisconduire.findByDateexpirationpermis", query = "SELECT c FROM CvPermisconduire c WHERE c.dateexpirationpermis = :dateexpirationpermis"),
    @NamedQuery(name = "CvPermisconduire.findByTypepermis", query = "SELECT c FROM CvPermisconduire c WHERE c.typepermis = :typepermis")})
public class CvPermisconduire implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cv_travailleur_id")
    private Integer cvTravailleurId;
    @Basic(optional = false)
    @Column(name = "numeropermis")
    private String numeropermis;
    @Column(name = "scanpermis")
    private String scanpermis;
    @Basic(optional = false)
    @Column(name = "dateexpirationpermis")
    @Temporal(TemporalType.DATE)
    private Date dateexpirationpermis;
    @Column(name = "typepermis")
    private String typepermis;
    @JoinColumn(name = "cv_travailleur_id", referencedColumnName = "id", insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private CvTravailleur cvTravailleur;

    public CvPermisconduire() {
    }

    public CvPermisconduire(Integer cvTravailleurId) {
        this.cvTravailleurId = cvTravailleurId;
    }

    public CvPermisconduire(Integer cvTravailleurId, String numeropermis, Date dateexpirationpermis) {
        this.cvTravailleurId = cvTravailleurId;
        this.numeropermis = numeropermis;
        this.dateexpirationpermis = dateexpirationpermis;
    }

    public Integer getCvTravailleurId() {
        return cvTravailleurId;
    }

    public void setCvTravailleurId(Integer cvTravailleurId) {
        this.cvTravailleurId = cvTravailleurId;
    }

    public String getNumeropermis() {
        return numeropermis;
    }

    public void setNumeropermis(String numeropermis) {
        this.numeropermis = numeropermis;
    }

    public String getScanpermis() {
        return scanpermis;
    }

    public void setScanpermis(String scanpermis) {
        this.scanpermis = scanpermis;
    }

    public Date getDateexpirationpermis() {
        return dateexpirationpermis;
    }

    public void setDateexpirationpermis(Date dateexpirationpermis) {
        this.dateexpirationpermis = dateexpirationpermis;
    }

    public String getTypepermis() {
        return typepermis;
    }

    public void setTypepermis(String typepermis) {
        this.typepermis = typepermis;
    }

    public CvTravailleur getCvTravailleur() {
        return cvTravailleur;
    }

    public void setCvTravailleur(CvTravailleur cvTravailleur) {
        this.cvTravailleur = cvTravailleur;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cvTravailleurId != null ? cvTravailleurId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvPermisconduire)) {
            return false;
        }
        CvPermisconduire other = (CvPermisconduire) object;
        if ((this.cvTravailleurId == null && other.cvTravailleurId != null) || (this.cvTravailleurId != null && !this.cvTravailleurId.equals(other.cvTravailleurId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvPermisconduire[ cvTravailleurId=" + cvTravailleurId + " ]";
    }
    
}
